package cn.com.visionsky.bocsz.bda.webservice.util;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.util.Collection;

/**
 * Created by 46043 on 2016/10/24.
 */

public class CommonUtils {
    private static final Logger logger = LoggerFactory
            .getLogger(CommonUtils.class);


	public static String byteArray2String(byte[] obj) {
		if(obj == null) return null;
		try {
			return new String(obj, "UTF-8");
		} catch(UnsupportedEncodingException e) {
			return null;
		}
	}

	public static void trimCollectionNullVal(Collection c) {
		CollectionUtils.filter(c, new Predicate() {
			@Override
			public boolean evaluate(Object o) {
				if(o == null)return false;
				else return true;
			}
		});
	}



}
